#!/usr/bin/perl

use strict;

my $file = $ARGV[0];
my $time = localtime();
my $del;

if(!$file){
	die "Please add your perl file name...\n";
}

if (-e $file){
	do{
		print "File $file already exists, delete...[y/N]";
		chomp ($del = <STDIN>);
	}while($del ne "y" && $del ne "N");

	if($del eq "y"){
		unlink($file) || die "Can not delete file: $file\n";
	}
	else{
		exit;
	}
}

open	FILE, ">", "$file";
print	FILE "#!/usr/bin/perl\n";
print	FILE "# " . "-"x72 . "\n";
print	FILE "#   File Name:\t$file\n";
print	FILE "#      Author:\tZhao Yanbai\n";
print	FILE "#             \t$time\n";
print	FILE "# Description:\tnone\n";
print	FILE "# " . "-"x72 . "\n";
print	FILE "use strict;\n\n";
close	FILE;
chmod	0755,$file;
